#include "NumberOfLifesProgressBar.h"

using namespace view;

NumberOfLifesProgressBar::NumberOfLifesProgressBar(SDLSurface* sdls) : SDLProgressBar(sdls)
{
}

NumberOfLifesProgressBar::NumberOfLifesProgressBar(SDLProgressMonitor* monitor, SDLSurface* sdls) : SDLProgressBar(monitor, sdls)
{
}

NumberOfLifesProgressBar::~NumberOfLifesProgressBar(void)
{
}

void NumberOfLifesProgressBar::draw(void)
{
	drawOuterTriangle(10);
	drawMiddleTriangle(10);
	drawInnerTriangle(10);

	drawOuterTriangle(30);
	drawMiddleTriangle(30);
	drawInnerTriangle(30);

	drawOuterTriangle(50);
	drawMiddleTriangle(50);
	drawInnerTriangle(50);
}

void NumberOfLifesProgressBar::drawOuterTriangle(int startXPos)
{
	int xpos = x+startXPos;
	int ypos = y;
	short xs[3], ys[3];

	xs[0] = xpos+4; // punto inicial
	xs[1] = xpos+10; // segundo vertice
	xs[2] = xpos+16; //tercer vertice

	ys[0] = ypos+5; // primer vertice de y, inicio
	ys[1] = ypos-6; // segundo vertice, aumenta altura
	ys[2] = ypos+5; // tercer vertice

	filledPolygonRGBA(sdlSurface->getSurface(), xs, ys, 3, borderColor->getRed(),
		borderColor->getGreen(), borderColor->getBlue(), borderColor->getAlpha());
}

void NumberOfLifesProgressBar::drawMiddleTriangle(int startXPos)
{
	int xpos = x+startXPos;
	int ypos = y;
	short xs[3], ys[3];

	xs[0] = xpos+6;
	xs[1] = xpos+10;
	xs[2] = xpos+14;

	ys[0] = ypos+4;
	ys[1] = ypos-4;
	ys[2] = ypos+4;

	filledPolygonRGBA(sdlSurface->getSurface(), xs, ys, 3, backgroundColor->getRed(),
		backgroundColor->getGreen(), backgroundColor->getBlue(), backgroundColor->getAlpha());
}

void NumberOfLifesProgressBar::drawInnerTriangle(int startXPos)
{
	int xpos = x+startXPos;
	int ypos = y;
	short xs[3], ys[3];

	xs[0] = xpos+9;
	xs[1] = xpos+10;
	xs[2] = xpos+11;

	ys[0] = ypos+2;
	ys[1] = ypos-1;
	ys[2] = ypos+2;

	filledPolygonRGBA(sdlSurface->getSurface(), xs, ys, 3, foregroundColor->getRed(),
		foregroundColor->getGreen(), foregroundColor->getBlue(), foregroundColor->getAlpha());
}
